home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 8542 / 8542.xpi / components / lastpasssearch.js < prev    next >
Text File  |  2010-02-14  |  4KB  |  12 lines

  1. const Cc=Components.classes;const Ci=Components.interfaces;const Cr=Components.results;const Cu=Components.utils;const LP_CLASS_ID=Components.ID("01258260-ceed-11de-8a39-0800200c9a66");const LP_CLASS_NAME="LastPass Autocomplete Search";const LP_CONTRACT_ID="@mozilla.org/autocomplete/search;1?name=lastpass";
  2. function lastpassAutoCompleteResult(B,A,E,D,C){this._searchString=B;this._searchResult=A;this._defaultIndex=E;this._errorDescription=D;this._results=C}lastpassAutoCompleteResult.prototype={_searchString:"",_searchResult:0,_defaultIndex:0,_errorDescription:"",_results:[],get searchStringfunction(){return this._searchString
  3. },get searchResultfunction(){return this._searchResult},get defaultIndexfunction(){return this._defaultIndex},get errorDescriptionfunction(){return this._errorDescription},get matchCountfunction(){return this._results.length},getCommentAt:function(A){if(!this._results||A>=this._results.length){return null
  4. }return this._results[A].comment},getImageAt:function(A){if(!this._results||A>=this._results.length){return null}return this._results[A].image},getStyleAt:function(A){if(!this._results||A>=this._results.length){return null}return this._results[A].style},getValueAt:function(A){if(!this._results||A>=this._results.length){return null
  5. }return this._results[A].value},removeValueAt:function(A,B){},QueryInterface:function(A){if(!A.equals(Ci.nsIAutoCompleteResult)&&!A.equals(Ci.nsISupports)){throw Components.results.NS_ERROR_NO_INTERFACE}return this}};function lastpassAutoCompleteSearch(){}lastpassAutoCompleteSearch.prototype={classDescription:LP_CLASS_NAME,ContractID:LP_CONTRACT_ID,classID:LP_CLASS_ID,_listener:null,_results:null,_searchString:null,startSearch:function lastpass_start_search(B,F,A,D){try{this._searchString=B;
  6. this._listener=D;if(!this._timer){this._timer=Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)}else{this._timer.cancel()}var C=Components.classes["@lastpass.com/lastpass;1"].getService().wrappedJSObject;this._results=C.autocomplete_search(B);this.processResult()}catch(E){}},processResult:function(){try{this._timer.initWithCallback(this,100,Ci.nsITimer.TYPE_ONE_SHOT)
  7. }catch(A){}},notify:function(B){try{if(this._results.length>0){this._listener.onSearchResult(this,new lastpassAutoCompleteResult(this._searchString,Ci.nsIAutoCompleteResult.RESULT_SUCCESS,0,"",this._results))}else{this._listener.onSearchResult(this,new lastpassAutoCompleteResult(this._searchString,Ci.nsIAutoCompleteResult.RESULT_NOMATCH,0,"",this._results))
  8. }}catch(A){}},stopSearch:function(){},QueryInterface:function(A){if(!A.equals(Ci.nsIAutoCompleteSearch)&&!A.equals(Ci.nsISupports)){throw Components.results.NS_ERROR_NO_INTERFACE}return this}};var lastpassAutoCompleteSearchFactory={singleton:null,createInstance:function(B,A){if(B!=null){throw Components.results.NS_ERROR_NO_AGGREGATION
  9. }if(this.singleton==null){this.singleton=new lastpassAutoCompleteSearch()}return this.singleton.QueryInterface(A)}};var lastpassAutoCompleteSearchModule={registerSelf:function(C,A,D,B){C=C.QueryInterface(Components.interfaces.nsIComponentRegistrar);C.registerFactoryLocation(LP_CLASS_ID,LP_CLASS_NAME,LP_CONTRACT_ID,A,D,B)
  10. },unregisterSelf:function(B,C,A){B=B.QueryInterface(Components.interfaces.nsIComponentRegistrar);B.unregisterFactoryLocation(LP_CLASS_ID,C)},getClassObject:function(B,C,A){if(!A.equals(Components.interfaces.nsIFactory)){throw Components.results.NS_ERROR_NOT_IMPLEMENTED}if(C.equals(LP_CLASS_ID)){return lastpassAutoCompleteSearchFactory
  11. }throw Components.results.NS_ERROR_NO_INTERFACE},canUnload:function(A){return true}};function NSGetModule(B,A){return lastpassAutoCompleteSearchModule};
  12.